local sk__liuyun = fk.CreateSkill {

  name = "sk__liuyun",

  tags = {  },

}



sk__liuyun:addEffect("active", {
  name = "sk__liuyun",
  anim_type = "support",
  card_num = 1,
  target_num = 1,
  prompt = "#sk__liuyun",
  can_use = function(self, player)
    return not player.chained and player:usedSkillTimes(sk__liuyun.name, Player.HistoryPhase) == 0
  end,
  card_filter = function(self, player, to_select, selected)
    return #selected == 0 and Fk:getCardById(to_select).color == Card.Black and
      not player:prohibitDiscard(to_select)
  end,
  target_filter=function (self, player, to_select, selected, selected_cards)
      return #selected == 0
  end,
  on_use = function(self, room, effect)
    local player = effect.from
    local target = effect.tos[1]
    room:throwCard(effect.cards, sk__liuyun.name, player, player)
    if not player.dead and not player.chained then
      player:setChainState(true)
    end
    if target.dead then return end
    local choices = {"draw2"}
    if target:isWounded() then
      table.insert(choices, "recover")
    end
    local choice = room:askForChoice(target, choices, sk__liuyun.name)
    if choice == "draw2" then
      target:drawCards(2, sk__liuyun.name)
    else
      room:recover({
        who = target,
        num = 1,
        recoverBy = player,
        skillName = sk__liuyun.name,
      })
    end
  end,
})

return sk__liuyun